updating oE nested_put

nested_put

include map.e 
namespace map 
public procedure nested_put(map the_map_p, sequence the_keys_p, object the_value_p, 
        integer operation_p = PUT, object deprecated_trigger_p = 0) 

adds or updates an entry on a map.

Parameters:
  1. the_map_p : the map where an entry is being added or updated
  2. the_keys_p : a sequence of keys for the nested maps
  3. the_value_p : an object, the value to add, or to use for updating.
  4. operation_p : an integer, indicating what is to be done with value. Defaults to PUT.
  5. deprecated_trigger_p : Deprecated. This parameter defaults to zero and is not used.
Comments:

Valid operations are:

  • PUT -- This is the default, and it replaces any value in there already
  • ADD -- Equivalent to using the += operator
  • SUBTRACT -- Equivalent to using the -= operator
  • MULTIPLY -- Equivalent to using the *= operator
  • DIVIDE -- Equivalent to using the /= operator
  • APPEND -- Appends the value to the existing data
  • CONCAT -- Equivalent to using the &= operator
  • If existing entry with the same key is already in the map, the value of the entry is updated.
Example 1:
map city_population 
city_population = new() 
nested_put(city_population, {"United States", "California", "Los Angeles"}, 
    3819951 ) 
nested_put(city_population, {"Canada",        "Ontario",    "Toronto"},      
    2503281 ) 
See Also:

put

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu